package br.com.fogas.database.entidade;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import br.com.fogas.database.IMetadata;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName=IMetadata.INotaItem.table_name)
public class NotaItem implements IMetadata, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@DatabaseField(generatedId = true, columnName=INotaItem.id)
	private Integer id;
	
	@DatabaseField(uniqueCombo=true, canBeNull=false, foreign=true, foreignAutoRefresh=true, columnName=INotaItem.tx_nota_fiscal)
	private NotaFiscal tx_nota_fiscal;
	
	@DatabaseField(uniqueCombo=true, canBeNull=false, foreign=true, foreignAutoRefresh=true, columnName=INotaItem.tx_material)
	private Material tx_material;
	
	@DatabaseField(uniqueCombo=true, canBeNull=false, width=6, columnName=INotaItem.tx_posicao_sap)
	private String tx_posicao_sap;
	
	@DatabaseField(dataType = DataType.BIG_DECIMAL_NUMERIC, columnName=INotaItem.nb_qtde)
	private BigDecimal nb_qtde;
	
	@DatabaseField(dataType = DataType.BIG_DECIMAL_NUMERIC, columnName=INotaItem.vl_total)
	private BigDecimal vl_total;
	
	@DatabaseField(dataType = DataType.BIG_DECIMAL_NUMERIC, columnName=INotaItem.vl_unitario)
	private BigDecimal vl_unitario;
	
	@DatabaseField(width=3, columnName=INotaItem.tx_cod_icms)
	private String tx_cod_icms;
	
	@DatabaseField(dataType = DataType.BIG_DECIMAL_NUMERIC, columnName=INotaItem.vl_icms)
	private BigDecimal vl_icms;
	
	@DatabaseField(dataType = DataType.BIG_DECIMAL_NUMERIC, columnName=INotaItem.vl_base_icms)
	private BigDecimal vl_base_icms;
	
	@ForeignCollectionField(eager = true)
	private ForeignCollection<NotaItemCondicoes> itemCondicoes;
	
	private List<NotaItemCondicoes> itemCondicoesTemp;
	
	public NotaItem() {
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public NotaFiscal getTx_nota_fiscal() {
		return tx_nota_fiscal;
	}

	public void setTx_nota_fiscal(NotaFiscal tx_nota_fiscal) {
		this.tx_nota_fiscal = tx_nota_fiscal;
	}

	public Material getTx_material() {
		return tx_material;
	}

	public void setTx_material(Material tx_material) {
		this.tx_material = tx_material;
	}

	public String getTx_posicao_sap() {
		return tx_posicao_sap;
	}

	public void setTx_posicao_sap(String tx_posicao_sap) {
		this.tx_posicao_sap = tx_posicao_sap;
	}

	public BigDecimal getNb_qtde() {
		return nb_qtde;
	}

	public void setNb_qtde(BigDecimal nb_qtde) {
		this.nb_qtde = nb_qtde;
	}

	public BigDecimal getVl_total() {
		return vl_total;
	}

	public void setVl_total(BigDecimal vl_total) {
		this.vl_total = vl_total;
	}

	public BigDecimal getVl_unitario() {
		return vl_unitario;
	}

	public void setVl_unitario(BigDecimal vl_unitario) {
		this.vl_unitario = vl_unitario;
	}

	public String getTx_cod_icms() {
		return tx_cod_icms;
	}

	public void setTx_cod_icms(String tx_cod_icms) {
		this.tx_cod_icms = tx_cod_icms;
	}

	public BigDecimal getVl_icms() {
		return vl_icms;
	}

	public void setVl_icms(BigDecimal vl_icms) {
		this.vl_icms = vl_icms;
	}

	public BigDecimal getVl_base_icms() {
		return vl_base_icms;
	}

	public void setVl_base_icms(BigDecimal vl_base_icms) {
		this.vl_base_icms = vl_base_icms;
	}

	public ForeignCollection<NotaItemCondicoes> getItemCondicoes() {
		return itemCondicoes;
	}

	public void setItemCondicoes(ForeignCollection<NotaItemCondicoes> itemCondicoes) {
		this.itemCondicoes = itemCondicoes;
	}

	public List<NotaItemCondicoes> getItemCondicoesTemp() {
		return itemCondicoesTemp;
	}
	
	public void setItemCondicoesTemp(List<NotaItemCondicoes> itemCondicoesTemp) {
		this.itemCondicoesTemp = itemCondicoesTemp;
	}
}